from django import forms

class AccountLoginForm(forms.Form):
    file = forms.ImageField()

class AccountLoginForm(forms.Form):
    username = forms.CharField(label="用户名",
                               min_length=1,
                               max_length=32,
                               error_messages={
                                   "required": "用户名不能为空",  # 当该字段设置为非空时，不填就会返回，用于重写为空时的提示
                                   "min_length": "用户名不能为空"
                               },
                               widget=forms.TextInput(attrs={'class': 'form-control', "placeholder": "用户名"}))
    password = forms.CharField(label="密码",
                               min_length=1,
                               error_messages={
                                   "required": "密码不能为空",  # 当该字段设置为非空时，不填就会返回，用于重写为空时的提示
                                   "min_length": "密码不能为空"
                               },
                               widget=forms.PasswordInput(attrs={'class': 'form-control', "placeholder": "密码"}))

    class Meta:
        fields = ['username', "password"]


class AccountRegisterForm(AccountLoginForm):
    email = forms.EmailField(label="邮箱",
                             min_length=1,
                             max_length=32,
                             error_messages={
                                 "required": "邮箱不能为空",  # 当该字段设置为非空时，不填就会返回，用于重写为空时的提示
                                 "min_length": "邮箱不能为空"
                             },
                             widget=forms.EmailInput(attrs={'class': 'form-control', "placeholder": "邮件"}))

    class Meta:
        fields = ['username', "password", 'email']
